﻿package com.eleme.service.impl;

import java.util.List;

import org.apache.log4j.Logger;

import com.eleme.dao.IBaseDao;
import com.eleme.dao.IDaoFactory;
import com.eleme.dao.impl.BaseDao;
import com.eleme.service.IBaseService;

/** 
 * ClassName: BaseServiceImpl <br/> 
 * Function: TODO ADD FUNCTION. <br/> 
 * Reason: TODO ADD REASON(可选). <br/> 
 * date: 2017年12月23日 下午3:23:45 <br/> 
 * 
 * @author Pan 
 * @version @param <T> 
 * @since JDK 1.8 
 */  
public abstract class BaseServiceImpl<T> implements IBaseService<T> {

	protected final static Logger LOGGER = Logger.getLogger(BaseServiceImpl.class);
	
	private IBaseDao<T> dao;
	
	protected IBaseDao<T> getDao() {
		return dao;
	}
	
	public BaseServiceImpl(IBaseDao<T> dao) {
		super();
		this.dao = dao;
	}

	public int insert(T entity) {
		return dao.insert(entity);
	}

	public int delete(int id) {
		return dao.delete(id);
	}

	public int update(T entity, int id) {
		return dao.update(entity, id);
	}

	public T getById(int id) {
		return dao.getById(id);
	}

	public List<T> getAll() {
		return dao.getAll();
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
